import {ADD_TO_CART, PRODUCT_COUNT_INCRE,CHECKED_ALL_GOODS} from './mutations-type'

export default {
	[PRODUCT_COUNT_INCRE](state, payload) {
		payload.count += 1
	},
	[ADD_TO_CART](state, payload) {
		payload.checked = true
		payload.count = 1
		state.cartGoods.push(payload)
	},
	[CHECKED_ALL_GOODS](state,payload) {
		for (const item of state.cartGoods) {
			item.checked = !payload
		}
	}
}